package com.soft.javase.ch10.test.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author wangzhisen
 * @Desc TODO
 * @date 2025/5/7
 * 2.筛选出Integer集合中大于7的元素，并打印，例如6,7,3,8,1,2,9
 */
public class FilterNumbers {
    public static void main(String[] args) {
        List<Integer> numbers = Arrays.asList(6, 7, 3, 8, 1, 2, 9);
        List<Integer> result = numbers.stream()
                .filter(n -> n > 7)
                .collect(Collectors.toList());
        System.out.println("大于7的元素: " + result);
    }
}
